#ifndef __CHANNELER_H__
#define __CHANNELER_H__

#include <fftw3.h>
#include <complex.h>
#include "data.h"
#include <string.h>

/* spectrum sub-channeling using pfb */
void channeler(double *data,double *coeffs,fftw_complex *subband,
                long res_num,int ntap,int nfft);

/* real to real fft */
void fft_r2r(double *in,double *out,int size);

/* real to complex fft */
void fft_r2c(double *in,fftw_complex *out,int size);

/* complex to complex fft */
void fft_c2c(fftw_complex *in,fftw_complex *out,long size);

/* complex to real fft */
void fft_c2r(fftw_complex *in,double *out,long size);

/* real to complex */
void real2complex(double *in, fftw_complex *out,long size);

/* insert data from odata to buffer */
void insert_data(double *in,double *data,int nfft,int ntap,int index);

/* ring_buffer for pfb */
void pfb_ring(double *data,fftw_complex *subband,double *coeffs,int index,int ntap,int nfft);

/* fft convolve */
void fft_convolve(double *d1,double *d2,double *out,size_t s1,size_t s2);

void lfilter(double *data,double *coeffs,double *out,size_t l1,size_t l2);

#endif